-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use shared informers to watch resource #615
Conversation
1e053b1
to
d45e1a2
Compare
@@ -38,6 +40,18 @@ import ( | |||
"k8s.io/client-go/util/homedir" | |||
) | |||
|
|||
var kubeClientCreatedCount = prometheus.NewCounterVec( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a ctx.Counter() ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kube client creation is called in a bunch of places and they don't pass in the context. So I did it this way.
9f05144
to
76fa84c
Compare
) | ||
|
||
// WatchResources watches Kubernetes resources | ||
func getUnstructuredFromInformedObj(resource v1.KubernetesResourceToWatch, obj any) (*unstructured.Unstructured, error) { | ||
b, err := json.Marshal(obj) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to marshal and unmarshall - It should be unstructured already ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we receive concrete types like core v1.Pod
} | ||
} | ||
|
||
factory := informers.NewSharedInformerFactory(ctx.Kubernetes(), 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this already prepopulated with kubeconfigs client ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ya we set it here
config-db/scrapers/kubernetes/events_watch.go
Line 134 in fd1e448
func applyKubeconfig(ctx api.ScrapeContext, kubeConfig types.EnvVar) (api.ScrapeContext, *rest.Config, error) { |
76fa84c
to
8c65ceb
Compare
🎉 This PR is included in version 0.0.318 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
No description provided.